﻿@model LoginRegisterModel
@using SpotsHub.Gateway.Models.Customer;
@using Nop.Core;
@using Nop.Core.Infrastructure;
@using Nop.Core.Infrastructure.DependencyManagement;

@{
    //register URL with return URL (if specified)
    var registerUrl = Url.RouteUrl("Register");
    string url = null;
    if (!String.IsNullOrEmpty(this.Context.Request.QueryString["returnUrl"]))
    {
        url = this.Context.Request.QueryString["returnUrl"];
        var webHelper = EngineContext.Current.Resolve<IWebHelper>();
        registerUrl = webHelper.ModifyQueryString(registerUrl, "returnurl=" + HttpUtility.UrlEncode(this.Context.Request.QueryString["returnUrl"]), null);
    }
}


<div class="login-block window">
    @using (Html.BeginForm("Login", "Customer", new { area = "Logistics", returnurl = url}))
    {
        @Html.Hidden("IsRegister", false);
        var loginfailedtext = Model.LoginModel.LoginFailed ? Model.LoginModel.LoginFailedText : "";
        var loginformerror = Model.LoginModel.LoginFailed ? "error" : "";
        <div class="page-title window-title grad-lightgrey grad">
            <div class="window-title-bar  grad-titleshine grad">
                <h2>Log In</h2>
                <!--<img src="/Content/images/spotsexpress-logo-small.png" />-->
            </div>
        </div>

        <div class="page-body window-content space">
            <div class="loginform-top">
                @if (Model.LoginModel.UsernamesEnabled)
                {
                <div class="login-username">
                    @*Html.LabelFor(m => m.Username)*@
                    <label>Email</label>
                    @Html.TextBoxFor(m => Model.LoginModel.Username, new { @class = "username " + loginformerror })
                    @Html.ValidationMessageFor(m => Model.LoginModel.Username)
                </div>
                }
                else
                {
                <div class="login-username">
                    @Html.LabelFor(m => Model.LoginModel.Email)
                    @if (Model.LoginModel.LoginFailed)
                    {
                        <div class="form-error-float"><div class="form-error-float-tail"></div>@loginfailedtext</div>
                    }
                    @Html.TextBoxFor(m => Model.LoginModel.Email, new { @class = "email " + loginformerror })
                </div>
                }
                <div class="login-password">
                @Html.LabelFor(m => Model.LoginModel.Password)
                @Html.PasswordFor(m => Model.LoginModel.Password, new { @class = "password " + loginformerror })
                </div>
            </div>
            <div class="login-forgot">
                @Html.RouteLink(T("Account.Login.ForgotPassword").Text, "LogisticsPasswordRecovery", null, new { @class = "password-recovery", rel= "nofollow" })
            </div>
            <div class="login-remember">
                @Html.CheckBoxFor(m => Model.LoginModel.RememberMe)
                @*Html.LabelFor(m => m.RememberMe)*@
                @Html.LabelFor(m => Model.LoginModel.RememberMe, "Remember Me")
            </div>

            @if (Model.LoginModel.DisplayCaptcha)
            {
            @Html.Raw(Html.GenerateCaptcha())
            }
            <div class="login-submit">
                <input class="login-button" type="submit" value="@T("Account.Login.LoginButton")" />
            </div>
            <div class="horizontal-rule-left"></div>
            <div class="horizontal-rule-right"></div>
            <div class="login-or">or</div>
            <div class="login-facebook">
                <a href="/" class="login-facebook-button"><div class="login-facebook-icon icon"></div>Sign In with Facebook</a>
            </div>
            <div class="login-bottom">
                <p>Don’t have an account? <a href="@registerUrl">Sign up here!</a></p>
            </div>
            <div class="content-clear"></div>
        </div>
    }
</div>
